package com.imooc.springcloud;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @desc
 * @author zkw
 * @date 2021-03-28
 */
@RestController
public class Controller {

    /**
     * 直接注入git-repo中配置的属性名
     */
    @Value("${info.name}")
    private String name;

    /**
     * 先从git-repo中将属性名注入到本地配置文件属性，再从本地配置文件中读取
     */
    @Value("${mywords}")
    private String words;

    @GetMapping("/name")
    public String getName() {
        return name;
    }

    @GetMapping("/words")
    public String getWords() {
        return words;
    }
}
